@extends('default.layouts.companyPublic')
@section('title', '搜索器')
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/company/company_search.css')}}">
@endsection
@section('rightcon')
    <div class="right">
        <!--搜索器-->
        <div class="jright">
            <div class="content">
                <div class="jobtitle">
                    <div class="tithead">
                        <h2>搜索器</h2>
                    </div>
                </div>
                <!--全能搜索-->
                <div class="implementinfo">
                    <div class="ileft"><span>目前共查找到<em>{{$companySearch->total()}}</em>个搜索器！点击名称即可按设置好的条件进行搜索。</span></div>
                    <div class="iright"><a href="{{url('company/search/create')}}">+新增搜索器</a></div>
                </div>
                <div class="searchList">
                    @if(count($companySearch) > 0)
                        @foreach($companySearch as $v)
                            <div class="searchInfo">
                                <div class="sleft">
                                    <dl>
                                        <dt><a href="{{$v->search_link}}" target="_blank">{{$v->search_name}}</a></dt>
                                        <dd>{{$v->updated_at}}</dd>
                                    </dl>
                                </div>
                                <div class="sright">
                                    <ul>
                                        <li class="edit"><a href="{{url('company/search/'.$v->id.'/edit')}}">编辑</a></li>
                                        <li class="del"><a onClick="delSearch('{{$v->id}}','{{$companySearch->currentPage()}}')">删除</a></li>
                                    </ul>
                                </div>
                            </div>
                        @endforeach
                    @else
                        <div class="nosearch"><span>您还没有添加搜索器!</span><a href="{{url('company/search/create')}}">马上添加>></a> </div>
                    @endif
                </div>
                {{--分页--}}
                <div class="page_list">
                    {!! $companySearch->links() !!}
                </div>
            </div>
        </div>
    </div>
@endsection
@section('footerjs')
    @parent
    <script>
        $('#leftnav_search').addClass('active');
        //删除搜索器
        function delSearch(id,currentPage) {
            layer.confirm('您确定要删除这个搜索器吗？', {
                    btn: ['确定','取消'] //按钮
                }, function(){
                    $.post("{{url('company/search/')}}/"+id,{'_method':'delete','currentPage':currentPage,'_token':"{{csrf_token()}}"},function (data) {
                        if(data.status==0){
                            layer.msg(data.msg, {icon: 6});
                            location = '{{url('company/search')}}';
                        }else{
                            layer.msg(data.msg, {icon: 5});
                        }
                    });
            });
        }
    </script>
@endsection